<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 数组迭代</title>
</head>
<body>
<h2>Array.lastIndexOf()</h2>
<p>与 Array.indexOf() 类似，但是从数组结尾开始搜索。</p>

<h1>JavaScript Array.lastIndexOf()</h1>

<p id="demo"></p>

<script>
  var fruits = ["Apple", "Orange", "Apple", "Mango"];
  var a=fruits.lastIndexOf("Apple");
  document.getElementById("demo").innerHTML = "Apple is found in position " + (a + 1);
</script>

</body>
</html>

<!--Apple is found in position 3-->
<!--array.lastIndexOf(item, start)      start:可选。从哪里开始搜索。负值将从结尾开始的给定位置开始，并搜索到开头。-->